<?php
namespace view;

class CookieEater{
	
	public function eatCookies(){
		
		if(isset($_POST['cookieEaterButton'])){
				$cookieEaterHtml = 'Cookies has been eaten nomnomnomnom...';
				$this->destroyCookie();
		}else if(isset($_COOKIE['username'])&& isset($_COOKIE['password'])){
		$cookieEaterHtml = '<form action="index.php" method="post">
	 			<button type="buttton" name="cookieEaterButton" 
	 			id="cookieEaterButton">Eat Cookies
	 			</button>
				</form>'
				;
		}else if(isset($_POST['checkbox'])){
			$cookieEaterHtml = '<form action="index.php" method="post">
	 			<button type="buttton" name="cookieEaterButton" 
	 			id="cookieEaterButton">Eat Cookies
	 			</button>
				</form>'
				;
		}else{
			$cookieEaterHtml = '';
		}
		return $cookieEaterHtml;
	}
	private function destroyCookie(){
		setcookie('username','',time()-3600);
		setcookie('password','',time()-3600);
	}
}
	